export  function formaDate(date,format='Y-M-D') {


	date = new Date(date)


	let Y = date.getFullYear()
	let M = date.getMonth() + 1
	let D = date.getDate()

	let h = date.getHours()
	let m = date.getMinutes()
	let s = date.getSeconds();
	
	let obj = {
		Y,M,D,h,m,s
	}
	let ymd= format.split(/[-\/\s]/).map(v=>{
		
		return obj[v]
	}).join('/');
	
	let hms = format.split(/\s/)[1]?format.split(/\s/)[1].split(/:/).map(v=>{
		
		return obj[v]
	}).join(':'):''
	
	return (ymd+''+hms).trim()
	
	//return `${year}-${month}-${day} ${h}:${m}:${s}`
}
